package com.cwb.study.springbootstudy.utill;

import java.text.SimpleDateFormat;
import java.util.Date;

@SuppressWarnings("ALL")
public class PayNoUtill {
    /**
     * 获取当前时间生成简单的流水号
     *
     * @return 返回字符串格式yyyyMMddHHmmss
     */
    public static String getStringDate() {
        Date currentTime = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        String dateString = sdf.format(currentTime);
        System.out.println(currentTime);
        return dateString;
    }

    /**
     * 由年月日时分秒+3位随机数
     * 生成流水号
     *
     * @return
     */
    public static String getNum() {
        String t = getStringDate();
        int x = (int) (Math.random() * 900) + 100;
        String serial = t + x;
        return serial;
    }


}
